package LeetCode;

public class LC_496_NextGreaterElementI {

    public static void main(String[] args) {

    }

    public class Solution {
        public int[] nextGreaterElement(int[] nums1, int[] nums2) {
            int len1 = nums1.length;
            int[] result = new int[len1];
            for (int i = 0; i < len1; i++) {
                result[i] = -1;
                int curNum = nums1[i];
                boolean startFlag = false;
                for (int aNums2 : nums2) {
                    if (aNums2 == curNum) {
                        startFlag = true;
                        continue;
                    }
                    if (startFlag && aNums2 > curNum) {
                        result[i] = aNums2;
                        break;
                    }
                }
            }
            return result;
        }

    }
}